import {createInstance} from "../createInstance.js";

const instance = createInstance('person');

// 添加个人新帐单
export const addPersonBill = (id, category, remark, amount, isComplete, billTime) => {
  return instance.post("/add", {
    id,
    category,
    remark,
    amount,
    isComplete,
    billTime
  });
};

// 删除个人账单
export const deletePersonBill = (id, billId) => {
  return instance.post("/delete", {
    id,
    billId,
  });
};

// 更新个人账单
export const updatePersonBill = (id, billId, category, remark, amount, isComplete, billTime) => {
  return instance.post("/update", {
    id,
    billId,
    category,
    remark,
    amount,
    isComplete,
    billTime
  });
};

// 获取个人账单
export const getPersonBill = (id) => {
  return instance.post("/get", {
    id,
  });
};

// 获取个人账单类型
export const getPersonBillCategory = (id) => {
  return instance.post("/getCategory", {
    id,
  });
};

// 添加个人账单类型
export const addPersonBillCategory = (id, name, is_out) => {
  return instance.post("/addCategory", {
    id,
    is_out,
    name
  });
};

// 删除个人账单类型
export const deletePersonBillCategory = (id, categoryId) => {
  return instance.post("/deleteCategory", {
    id,
    categoryId,
  });
};
